<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>显示所有学生信息</title>
  <style>
    /* 设置背景图片 */
    body {
    margin: 0;
    padding: 0;
    background-image: url('img/sky.jpg'); /* 替换为你的图片路径 */
    background-attachment: fixed; /* 使背景图片固定 */
    background-position: center; /* 图片居中 */
    background-repeat: no-repeat; /* 不重复图片 */
    background-size: cover; /* 图片覆盖整个背景 */
    }
    /* 设置表格样式 */
    table {
      width: 80%;
      margin: 50px auto;
      background-color: rgba(255, 255, 255, 0.8); /* 表格背景颜色，半透明 */
      border-collapse: collapse;
    }
    th, td {
      padding: 15px;
      text-align: left;
      border: 1px solid #ddd;
    }
    /* 查询表单样式 */
    .search-form {
      width: 80%;
      margin: 20px auto;
      text-align: center;
    }
    .search-form input[type="text"], .search-form select {
      padding: 10px;
      margin: 5px;
      border: 1px solid #ccc;
      border-radius: 4px;
    }
    .search-form input[type="submit"] {
      padding: 10px 20px;
      background-color: #28a745;
      border: none;
      border-radius: 4px;
      color: #fff;
      cursor: pointer;
    }
  </style>
</head>
<body>
<h2 align="center">显示所有学生信息</h2>
<!-- 查询表单 -->
<div class="search-form">
  <form action="students" method="get">
    <input type="hidden" name="action" value="search">
    学号: <input type="text" name="studentId" placeholder="请输入学号">
    姓名: <input type="text" name="studentName" placeholder="请输入姓名">
    性别:
    <select name="sex">
      <option value="">全部</option>
      <option value="男">男</option>
      <option value="女">女</option>
    </select>
    <input type="submit" value="查询">
  </form>
</div>

<!-- 学生列表 -->
<table>
  <tr>
    <th>学号</th>
    <th>姓名</th>
    <th>性别</th>
    <th>班级</th>
    <th>修改</th>
    <th>删除</th>
  </tr>
  <c:forEach items="${students}" var="student">
    <tr>
      <td align="center">${student.studentId}</td>
      <td align="center">${student.studentName}</td>
      <td align="center">${student.sex}</td>
      <td align="center">${student.className}</td>
      <td align="center"><a href="students?action=edit&id=${student.studentId}&pwd=${student.studentPwd}">修改</a></td>
      <td align="center"><a href="students?action=delete&id=${student.studentId}">删除</a></td>
    </tr>
  </c:forEach>
</table>
<p align="center"><a href="students?action=new" ><b>插入一个学生信息</b></a></p>

</body>
</html>